home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / FILER / TARSRC.SPK / h / tar < prev    next >
Text File  |  1994-09-13  |  4KB  |  159 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "os.h"
  5. #include "swis.h"
  6.  
  7. #define MAX_EXIT_CODE           24
  8.  
  9. #define ARC_MAGIC               "Archie "
  10. #define ARC_FLAG                'A'
  11.  
  12. #define TAR_FILETYPE_VAR        "tar$filetype"
  13. #define COMPRESS_VAR            "tar$compress"
  14. #define DECOMPRESS_VAR          "tar$decompress"
  15. #define COMPEXT_VAR             "tar$compress$extension"
  16. #define SCRAP_VAR               "tar$scrap"
  17.  
  18. #define RECORDSIZE              512
  19. #define NBLOCK                  20
  20. #define MAXUNUSED               20480
  21.  
  22. #define NAMSIZ                  100
  23. #define MAXPATHLEN              256
  24.  
  25. typedef union HeaderBlock {
  26.         char Block[RECORDSIZE];
  27.         struct header {
  28.                 char name[NAMSIZ];
  29.                 char mode[8];
  30.                 char uid[8];
  31.                 char gid[8];
  32.                 char size[12];
  33.                 char mtime[12];
  34.                 char chksum[8];
  35.                 char linkflag;
  36.                 char linkname[NAMSIZ];
  37.                 char magic[8];
  38.                 char LoadAddress[12];
  39.                 char ExecAddress[12];
  40.                 char Attr[12];
  41.                 char Date[12];
  42.                 char compression[12];
  43.                 char archieflag;
  44.                 char compressed;
  45.                 char ExtentNo[8];
  46.         } Header;
  47. } Block_t;
  48.  
  49. #define LF_OLDNORMAL    '\0'            /* Normal disk file, Unix compat */
  50. #define LF_NORMAL       '0'             /* Normal disk file */
  51. #define LF_LINK         '1'             /* Link to previously dumped file */
  52. #define LF_SYMLINK      '2'             /* Symbolic link */
  53. #define LF_CHR          '3'             /* Character special file */
  54. #define LF_BLK          '4'             /* Block special file */
  55. #define LF_DIR          '5'             /* Directory */
  56. #define LF_FIFO         '6'             /* FIFO special file */
  57. #define LF_CONTIG       '7'             /* Contiguous file */
  58.  
  59. #define LF_DUMPDIR      'D'             /* This is a dump dir entry */
  60. #define LF_EXTENT       'X'             /* This is an extent of a file. */
  61. #define LF_LASTEXTENT   'L'
  62. #define LF_VOLHDR       'V'             /* This file is a tape/volume header */
  63. #define LF_VOLEND       'E'             /* This file is a tape/volume end */
  64. #define LF_GNUEXTENT    'M'             /* GNU tar extent of a file */
  65.  
  66. #define CF_COMPRESSED   'Z'             /* The file is compressed */
  67.  
  68. typedef enum {
  69.   tapedevice_FILE, tapedevice_DISC, tapedevice_RMT
  70. } tapedevice_t;
  71.  
  72. typedef enum {
  73.   t_NotFound, t_FileFound, t_DirFound, t_ImageFileFound
  74. } ObjectType;
  75.  
  76. typedef struct catinfo {
  77.   long LoadAddress;
  78.   long ExecAddress;
  79.   long Length;
  80.   long Attr;
  81.   long Type;
  82.   long SIN;
  83.   char DateAndName[256];
  84. } CatInfo;
  85.  
  86.  
  87. extern void usage(void);
  88. extern void Terminate(int);
  89. extern char Decision(char);
  90. extern int chkos(os_error *);
  91. extern int ExecuteCommand(char *, char *, char *, int);
  92. extern void compress_cleanup(void);
  93. extern void PrintBlocks(FILE *, long);
  94. extern void ChkScrapName(void);
  95.  
  96.  
  97. extern int CreateArchive;
  98. extern int ArchiveFileSpecified;
  99. extern int IgnoreArchiveErrors;
  100. extern int UseListFile;
  101. extern int DoNotExtractFileDates;
  102. extern int ConvertExclamationMark;
  103. extern int AppendToArchive;
  104. extern int SwapExtensionToDir;
  105. extern int ListArchivesContents;
  106. extern int Verbose;
  107. extern int ConfirmActions;
  108. extern int ExtractFromArchive;
  109. extern int CompressFiles;
  110. extern int Reblock;
  111. extern int PeriodSlashConversion;
  112. extern int FormatFloppies;
  113. extern int MultipleVolumes;
  114. extern int GNUmultipleVolumes;
  115. extern int NoDiskDestroyConfirmation;
  116. extern int QuietExecution;
  117. extern int SwapInWholePath;
  118. extern int CommaFileTypes;
  119. extern int UnixArchive;
  120. extern int VeryVerbose;
  121. extern int AddFileTypeExtension;
  122. extern int ConvertCompressExtension;
  123. extern int UseCanonicalisedPaths;
  124. extern int MaxLeafLength;
  125.  
  126. extern int tarFileType;
  127.  
  128. extern int MaxExtLength;
  129.  
  130. extern tapedevice_t tapedevice;
  131. extern int driveno;
  132. extern char format;
  133.  
  134. extern char *listfile;
  135. extern char *ArchiveName;
  136. extern int ArchiveOpen;
  137. extern FILE *ArchiveFD;
  138. extern int rmt_fd;
  139.  
  140. extern int UserInterrupt;
  141.  
  142. extern Block_t *TmpBlock;
  143. extern Block_t Block;
  144.  
  145. extern int NumBlocksRead;
  146. extern int nblock;
  147. extern int recno;
  148. extern int first;
  149. extern int DiscNo;
  150. extern int compression;
  151.  
  152. extern int isArchie;
  153.  
  154. extern char ScrapName[MAXPATHLEN];
  155. extern char ScrapNameZ[MAXPATHLEN];
  156. extern char CompressExt[256];
  157. extern char CompressTemplate[MAXPATHLEN];
  158. extern char DecompressTemplate[MAXPATHLEN];
  159.